package model

import (
	"time"
)

// Account [...]
type Account struct {
	ID          int       `gorm:"primaryKey;column:id;type:int;not null" json:"id"`
	FirstName   string    `gorm:"column:first_name;type:varchar(20);not null" json:"first_name"`
	LastName    string    `gorm:"column:last_name;type:varchar(20);not null" json:"last_name"`
	Username    string    `gorm:"unique;column:username;type:varchar(20);not null" json:"username"`
	Password    string    `gorm:"column:password;type:varchar(20);not null" json:"password"`
	Phone       string    `gorm:"column:phone;type:varchar(20)" json:"phone"`
	Email       string    `gorm:"column:email;type:varchar(30)" json:"email"`
	Enabled     bool      `gorm:"column:enabled;type:tinyint(1)" json:"enabled"`
	Gender      string    `gorm:"column:gender;type:varchar(10)" json:"gender"`
	CreatedTime time.Time `gorm:"column:created_time;type:timestamp;default:CURRENT_TIMESTAMP" json:"created_time"`
	UpdatedTime time.Time `gorm:"column:updated_time;type:timestamp;default:CURRENT_TIMESTAMP" json:"updated_time"`
}

// TableName get sql table name.获取数据库表名
func (m *Account) TableName() string {
	return "account"
}

// AccountColumns get sql column name.获取数据库列名
var AccountColumns = struct {
	ID          string
	FirstName   string
	LastName    string
	Username    string
	Password    string
	Phone       string
	Email       string
	Enabled     string
	Gender      string
	CreatedTime string
	UpdatedTime string
}{
	ID:          "id",
	FirstName:   "first_name",
	LastName:    "last_name",
	Username:    "username",
	Password:    "password",
	Phone:       "phone",
	Email:       "email",
	Enabled:     "enabled",
	Gender:      "gender",
	CreatedTime: "created_time",
	UpdatedTime: "updated_time",
}
